home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif,comp.lang.c++
- Path: uu4news.netcom.com!amc-gw!curtis
- From: curtis@amc.com (Curtis Green)
- Subject: Re: MOTIF Callbacks, C++ Member Functions - SOLVED
- Message-ID: <1996Feb29.210244.8595@amc.com>
- Organization: Applied Microsystems Corporation
- X-Newsreader: TIN [version 1.1 PL6]
- References: <4gbf05$6d8@rex.sfe.com.au>
- Distribution: inet
- Date: Thu, 29 Feb 1996 21:02:44 GMT
-
- Paul Hatchman (paul@sfe.com.au) wrote:
- : danubius@chinook.halcyon.com () writes:
- :
- : >Wintermute <3mal5@qlink.queensu.ca> wrote:
- : >>
- : >>The solution was to declare a static member function which is used as a
- : >>callback. Since it is static, there is no 'this' pointer, and it works
- : >>fine. To access the particular class instance, pass the 'this' pointer
- : >>as client data when installing the callback, and it will be available
- : >>when the static member function is called back.
- :
- : >Which is exactly the method Doug Young uses in his book on Motif with
- : >C++.
- :
- : >Joe
- :
- : I dont think there are any guarantees that a compiler will give static
- : functions "C" style linkage. It works with every compiler I have tried, but I
- : dont believe it is guaranteed to be portable.
-
- The static member function gets placed on the heap area so at compile time
- the compiler has a reference to it, though it is part of a class. The compiler
- needs to know where the callback is when it compiles. Weather or not the
- name is mangled is inconsequential in this context.
-
- :
- : Can someone give an authorative answer on this?
- :
- : - Paul
- :
- : --------------------------------------------------------------------------------
- : Paul Hatchman, | <this line intentionally left blank>
- : Project Leader, | paul@sfe.com.au
- : Sydney Futures Exchange, Australia | Tel: +61 2 2560567
- : --------------------------------------------------------------------------------
-
- --
- Be seeing you...
-
- Curtis Green | Software Engineer
- curtis@amc.com | Applied Microsystems Embedded Systems
- | http://www.amc.com
- My opinions are |
- expressly mine | This year Khan escapes Earth on the Botany Bay.
- on my own. | (Cliff Clavin, 1996)
-